package com.livesource.client.web.projectBacklog;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.livesource.client.utilities.ButtonRefresh;

/**
 * Show the list of the planning features.
 * 
 */
public class ProjectBacklogPage extends VerticalPanel {

	public static VerticalPanel vpProjectBacklog = new VerticalPanel();

	public ProjectBacklogPage() {

		this.setSpacing(20);

		this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

		HTML html = new HTML(
				"<b><font color='blue' size='3'>Project Backlog</font></b> ");
		this.add(html);

		this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);

		HorizontalPanel hp2 = new HorizontalPanel();

		hp2.add(new ButtonRefresh(buttonRefreshClickHandler()));

		hp2.add(new ButtonNewBacklog());
		// hp2.add(HelpWindow
		// .helpIcon(
		// "LiveSource",
		// "src.sourceagile.planning.client.projectBacklog.ProjectBacklogList",
		// GlobalVariables.locale));

		this.add(hp2);

		vpProjectBacklog.clear();

		vpProjectBacklog
				.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

		vpProjectBacklog.add(new ProjectBacklogList());

		this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

		this.add(vpProjectBacklog);
	}

	private ClickHandler buttonRefreshClickHandler() {

		return (new ClickHandler() {

			@Override
			public void onClick(ClickEvent event) {

				vpProjectBacklog.clear();

				vpProjectBacklog.add(new ProjectBacklogList());
			}
		});

	}
}
